﻿// /* **********************************************************************************
//  *
//  * Copyright (c) Sky Sanders. All rights reserved.
//  * 
//  * This source code is subject to terms and conditions of the Microsoft Public
//  * License (Ms-PL). A copy of the license can be found in the license.htm file
//  * included in this distribution.
//  *
//  * You must not remove this notice, or any other, from this software.
//  *
//  * **********************************************************************************/
using System;
using System.IO;
using SimpleRemoteControl.Configuration;


namespace SimpleRemoteControl
{
    public static class Common
    {
        private static RemoteControlSection _config;

        public static RemoteControlSection Config
        {
            get
            {
                if (_config == null)
                {
                    _config = RemoteControlSection.DefaultInstance;
                }

                return _config;
            }
        }

        /// <summary>
        /// Quick and dirty platform sniffing, like i like it sometimes.
        /// </summary>
        public static OS Platform
        {
            get
            {
                if (Environment.OSVersion.Platform == PlatformID.Win32Windows ||
                    Environment.OSVersion.Platform == PlatformID.Win32NT)
                {
                    return OS.Win;
                }

                if (Directory.Exists("/System/Library/WidgetResources"))
                {
                    return OS.Osx;
                }
                return OS.Linux;
            }
        }
    }


    public enum OS
    {
        Win,
        Osx,
        Linux
    }
}